package cn.com.wangluotongxin.chat.model.constants;

public enum SendMessageType {

    TEXT(1, "文本"),
    IMAGE(2, "图片"),
    VOICE(3, "语音"),
    VIDEO(4, "视频");

    private Integer code;
    public Integer getCode(){
        return this.code;
    }

    private String name;
    public String getName(){
        return this.name;
    }

    public static SendMessageType getByCode(Integer code){
        if(code == null){
            return null;
        }else {
            SendMessageType[] sendMessageTypes = values();
            for(SendMessageType sendMessageType : sendMessageTypes){
                if(sendMessageType.getCode().equals(code)){
                    return sendMessageType;
                }
            }
        }
        return null;
    }

    SendMessageType(Integer code, String name){
        this.code = code;
        this.name = name;
    }
}
